﻿<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:SampleData="clr-namespace:Expression.Blend.SampleData.SampleDataSource" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:myBoard_App="clr-namespace:myBoard.App" x:Class="myBoard.App.Controls.Notification.NotificationsWindow"
    Title="myBoard notifications" Height="Auto" Width="Auto" mc:Ignorable="d" Background="{x:Null}" WindowStyle="None" ShowInTaskbar="False" Topmost="True" SizeToContent="WidthAndHeight" HorizontalAlignment="Right" VerticalAlignment="Top" AllowsTransparency="True">
	<Window.Resources>
		<SampleData:SampleDataSource x:Key="SampleDataSource" d:IsDataSource="True"/>
		<DataTemplate x:Key="NotificationDataTemplate">
			<DataTemplate.Resources>
				<Storyboard x:Key="ShowCloseBt">
					<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="_closeBt" Storyboard.TargetProperty="(UIElement.Visibility)">
						<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
					</ObjectAnimationUsingKeyFrames>
					<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="_closeBt" Storyboard.TargetProperty="(UIElement.Opacity)">
						<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
						<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1" KeySpline="0,1,1,1"/>
					</DoubleAnimationUsingKeyFrames>
				</Storyboard>
				<Storyboard x:Key="HideCloseBt">
					<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="_closeBt" Storyboard.TargetProperty="(UIElement.Opacity)">
						<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0" KeySpline="0,1,1,1"/>
					</DoubleAnimationUsingKeyFrames>
					<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="_closeBt" Storyboard.TargetProperty="(UIElement.Visibility)">
						<DiscreteObjectKeyFrame KeyTime="00:00:00.3000000" Value="{x:Static Visibility.Visible}"/>
						<DiscreteObjectKeyFrame KeyTime="00:00:00.4000000" Value="{x:Static Visibility.Collapsed}"/>
					</ObjectAnimationUsingKeyFrames>
				</Storyboard>
			</DataTemplate.Resources>
			<Grid>
				<Border x:Name="LayoutRoot" VerticalAlignment="Top" BorderThickness="0,1,0,0.5" CornerRadius="8,8,8,8" d:LayoutOverrides="Width" Margin="20,10,20,0">
					<Border.Background>
						<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
							<GradientStop Color="#A5000000" Offset="0"/>
							<GradientStop Color="#A5414141" Offset="1"/>
						</LinearGradientBrush>
					</Border.Background>
					<Border.Effect>
						<DropShadowEffect BlurRadius="18"/>
					</Border.Effect>
					<Border.BorderBrush>
						<LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,1">
							<GradientStop Color="#FF000000" Offset="0.94"/>
							<GradientStop Color="#FFBDBDBD" Offset="1"/>
						</LinearGradientBrush>
					</Border.BorderBrush>
					<Grid Width="Auto" Height="Auto">
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="0.302*"/>
							<ColumnDefinition Width="0.698*"/>
						</Grid.ColumnDefinitions>
						<StackPanel VerticalAlignment="Top" Grid.Column="1" Margin="5,0,0,0">
							<TextBlock x:Name="_title" Margin="6,4,0,0" FontFamily="Calibri" FontSize="16" Foreground="#FFFFFFFF" Text="{Binding Path=Title, Mode=Default}" TextWrapping="Wrap" Width="180" HorizontalAlignment="Left" Background="#00000000" Cursor="Hand" MouseLeftButtonUp="_title_MouseLeftButtonUp"/>
							<TextBlock x:Name="_desc" Margin="6,10,6,15" FontFamily="Calibri" FontSize="12" Foreground="#FFFFFFFF" Text="{Binding Path=Text, Mode=Default}" TextWrapping="Wrap" TextAlignment="Justify" Width="200"/>
							<StackPanel Width="Auto" Height="Auto" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,5,5">
								<TextBlock x:Name="_title_Copy" Margin="0,0,0,0" FontFamily="Calibri" FontSize="12" Foreground="#FFFFFFFF" Text="from" TextWrapping="Wrap" HorizontalAlignment="Right" VerticalAlignment="Bottom"/>
								<TextBlock x:Name="_source" Margin="5,0,0,0" FontFamily="Calibri" FontSize="12" Foreground="#FFFFFFFF" Text="{Binding Path=Source, Mode=Default}" TextWrapping="Wrap" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="Auto" MaxWidth="160"/>
							</StackPanel>
						</StackPanel>
						<Button VerticalAlignment="Top" Style="{DynamicResource PictureButton}" Margin="5,5,0,0">
							<Image Source="{Binding Path=Illustration, Mode=Default}"/>
						</Button>
					</Grid>
				</Border>
				<myBoard_App:CloseBt x:Name="_closeBt" HorizontalAlignment="Right" VerticalAlignment="Top" d:LayoutOverrides="Height" Visibility="Collapsed" Opacity="0" Click="_closeBt_Click" RenderTransformOrigin="0.5,0.5" Margin="0,0,10,0">
					<myBoard_App:CloseBt.RenderTransform>
						<TransformGroup>
							<ScaleTransform ScaleX="1" ScaleY="1"/>
							<SkewTransform AngleX="0" AngleY="0"/>
							<RotateTransform Angle="0"/>
							<TranslateTransform X="0" Y="0"/>
						</TransformGroup>
					</myBoard_App:CloseBt.RenderTransform>
				</myBoard_App:CloseBt>
			</Grid>
			<DataTemplate.Triggers>
				<EventTrigger RoutedEvent="Mouse.MouseEnter">
					<BeginStoryboard Storyboard="{StaticResource ShowCloseBt}"/>
				</EventTrigger>
				<EventTrigger RoutedEvent="Mouse.MouseLeave">
					<BeginStoryboard x:Name="HideCloseBt_BeginStoryboard" Storyboard="{StaticResource HideCloseBt}"/>
				</EventTrigger>
			</DataTemplate.Triggers>
		</DataTemplate>
		<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}">
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
			<Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
			<Setter Property="Padding" Value="2,0,0,0"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type ListBoxItem}">
						<Border x:Name="Bd" SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" Margin="0,0,0,15">
							<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Storyboard x:Key="ShowNotifications">
			<ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="_notificationsList" Storyboard.TargetProperty="(FrameworkElement.Margin)">
				<SplineThicknessKeyFrame KeyTime="00:00:00.3000000" Value="0,20,0,0" KeySpline="0,1,1,1"/>
				<SplineThicknessKeyFrame KeyTime="00:00:00.4000000" Value="0,-10,0,0" KeySpline="1,0,1,1"/>
				<SplineThicknessKeyFrame KeyTime="00:00:00.5000000" Value="0,0,0,0" KeySpline="0,1,1,1"/>
			</ThicknessAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="_notificationsList" Storyboard.TargetProperty="(UIElement.Opacity)">
				<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1"/>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>
		<Storyboard x:Key="HideNotifications">
			<ThicknessAnimationUsingKeyFrames Name="MarginTimeline" BeginTime="00:00:00" Storyboard.TargetName="_notificationsList" Storyboard.TargetProperty="(FrameworkElement.Margin)">
				<SplineThicknessKeyFrame KeySpline="1,0,1,1" KeyTime="00:00:00.2000000" Value="0,20,0,0"/>
				<SplineThicknessKeyFrame KeySpline="0,1,1,1" KeyTime="00:00:00.5000000" Value="0,-600,0,0"/>
			</ThicknessAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="_notificationsList" Storyboard.TargetProperty="(UIElement.Opacity)">
				<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0.8"/>
				<SplineDoubleKeyFrame KeySpline="0,1,1,1" KeyTime="00:00:00.5000000" Value="0"/>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>
	</Window.Resources>
	<d:DataContext>
		<Binding Path="Notifications" Mode="Default" Source="{StaticResource SampleDataSource}"/>
	</d:DataContext>
	<Window.DataContext>
		<Binding Path="Notifications" Mode="Default" Source="{StaticResource SampleDataSource}"/>
	</Window.DataContext>
    <Grid>
        
    	<ListBox x:Name="_notificationsList" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" IsSynchronizedWithCurrentItem="True" ItemTemplate="{DynamicResource NotificationDataTemplate}" ItemsSource="{Binding Mode=OneWay}" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden" Background="{x:Null}" ItemContainerStyle="{DynamicResource ListBoxItemStyle1}" Margin="0,-600,0,0" Opacity="1" BorderBrush="{x:Null}"/>
        
    </Grid>
</Window>
